<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ page session="false" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.net.test.vo.ExboardVO" %>

<script>
function go_write(){
	var frm = document.myfrm;
	frm.action = "/exWrite.ncb";
	
	
	frm.submit();
	
}
function go_view(param){	
	
	var frm = document.myfrm;
	frm.title.value = param;
	
	/*if(frm.title.value =="null"){		
		alert("제목이없어");		
		
		return;
	}*/	
	frm.action = "/exView.ncb";
		
	frm.submit();
}



</script>


<div style="width:600px; height: 600px; ">



<form name="myfrm" method="post">
    
    <input type="hidden" name="title">
    
    
    <table width="90%" cellpadding="5" cellspacing="0" border="1" style="border-collapse:collapse; border:1px gray solid;">
        <tr>
            <td width="10%" align="center">번호</td>
            <td width="30%" align="center">제목</td>
            <td width="50%" align="center">내용</td>
            
            
        </tr>
        
        <%
        ArrayList<ExboardVO> list = (ArrayList<ExboardVO>)request.getAttribute("list");
        %>
        
        <%
        for(int i = 0; i<list.size(); i++){
        %>
        <tr>
            <td width="10%" align="center" > <%=i+1 %> </td>
            
            <%
            if(list.get(i).getBoard_Title()== null){            	
             %>
            
            <td width="30%" align="center"  > <%=list.get(i).getBoard_Title() %>
            <%
            }else{
            %>           
            <td width="30%" align="center" onclick="javascript:go_view('<%=list.get(i).getBoard_Title() %>')" > <%=list.get(i).getBoard_Title() %>
             <%
            }
             %>
            
            </td>
            
            <td width="50%" align="center"><%=list.get(i).getBoard_Contents() %></td>
        </tr>
        <%
        }
        %>
    </table>
    
	<input type="button" value="글쓰기" onclick="javascript:go_write();"/>
	

</form>
</div>


